//
//  HELFilterView.m
//  HandheldELearn
//
//  Created by 陈武琦 on 16/7/12.
//  Copyright © 2016年 陈武琦. All rights reserved.
//

#import "HELFilterView.h"

@implementation HELFilterView

- (void)awakeFromNib {
    self.allStates.selected = YES;
    self.lasted.selected = YES;
}

- (IBAction)allStatePress:(UIButton *)sender {
    sender.selected = YES;
    self.completed.selected = NO;
    self.uncompeleted.selected = NO;
    if ([_delegate respondsToSelector:@selector(HELFilterViewDidSelect:)]) { // 如果协议响应了sendValue:方法
        [_delegate HELFilterViewDidSelect:[NSIndexPath indexPathForRow:0 inSection:0]]; // 通知执行协议方法
    }

}
- (IBAction)uncompeletedPress:(UIButton *)sender {
    sender.selected = YES;
    self.allStates.selected = NO;
    self.completed.selected = NO;
    if ([_delegate respondsToSelector:@selector(HELFilterViewDidSelect:)]) { // 如果协议响应了sendValue:方法
        [_delegate HELFilterViewDidSelect:[NSIndexPath indexPathForRow:1 inSection:0]]; // 通知执行协议方法
    }
}
- (IBAction)compeletedPress:(UIButton *)sender {
    sender.selected = YES;
    self.allStates.selected = NO;
    self.uncompeleted.selected = NO;
    if ([_delegate respondsToSelector:@selector(HELFilterViewDidSelect:)]) { // 如果协议响应了sendValue:方法
        [_delegate HELFilterViewDidSelect:[NSIndexPath indexPathForRow:2 inSection:0]]; // 通知执行协议方法
    }
}



- (IBAction)lastestPress:(UIButton *)sender {
    sender.selected = YES;
    self.progress.selected = NO;
    if ([_delegate respondsToSelector:@selector(HELFilterViewDidSelect:)]) { // 如果协议响应了sendValue:方法
        [_delegate HELFilterViewDidSelect:[NSIndexPath indexPathForRow:0 inSection:1]]; // 通知执行协议方法
    }
}
- (IBAction)progressPress:(UIButton *)sender {
    sender.selected = YES;
    self.lasted.selected = NO;
    if ([_delegate respondsToSelector:@selector(HELFilterViewDidSelect:)]) { // 如果协议响应了sendValue:方法
        [_delegate HELFilterViewDidSelect:[NSIndexPath indexPathForRow:1 inSection:1]]; // 通知执行协议方法
    }
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
